home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir43 / med300.zip / MEEDIT.CLA < prev    next >
Text File  |  1994-02-22  |  28KB  |  497 lines

  1.  
  2. !▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  3. !█                                                                       █
  4. !█ MEEDIT.CLA                                                            █
  5. !█ Main edit procedure for MemoEdit                                      █
  6. !█                                                                       █
  7. !█ Revision Number: 1                                                    █
  8. !█ Revision Date  : 22-Feb-94                                            █
  9. !█                                                                       █
  10. !█ Revision History                                                      █
  11. !█   1 Created                                                           █
  12. !█                                                                       █
  13. !▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  14.  
  15.              MEMBER('MEMOEDIT')
  16.  
  17. !═════════════════════════════════════════════════════════════════════════
  18. !                   Main edit procedure for MemoEdit
  19. !═════════════════════════════════════════════════════════════════════════
  20. ME_Edit      PROCEDURE
  21.  
  22.              ! Equates:
  23. eFileMsg     EQUATE('Mark block to PUT, then press ENTER')
  24. eDeleteMsg   EQUATE('Mark block to DELETE, then press ENTER')
  25. eCopy1Msg    EQUATE('Mark block to COPY, then press ENTER')
  26. eCopy2Msg    EQUATE('Point to destination, then press ENTER to COPY')
  27. eMove1Msg    EQUATE('Mark block to MOVE, then press ENTER')
  28. eMove2Msg    EQUATE('Point to destination, then press ENTER to MOVE')
  29.  
  30.              ! Locals:
  31. isKeystroke  SHORT                               ! Last keystroke
  32. bbAlerted    BYTE                                ! ALERTed key pressed
  33. bbCommand    BYTE                                ! Command sequence pressed
  34. bbExit       BYTE                                ! Exit flag
  35.  
  36. bbNewCol     BYTE                                ! Column change flag
  37. isSavCol     SHORT                               ! Saved column position
  38.  
  39. sText        STRING(80)                          ! Text string
  40. isTextLen    SHORT                               ! Length of text string
  41.  
  42. sStatus      STRING(76)                          ! Status line string
  43. rHorizRuler  REAL                                ! Horizontal ruler
  44. ubCodeNdx    BYTE                                ! Code array index
  45. ilStyle      LONG                                ! Line style flags
  46. ubChar       BYTE                                ! Character under cursor
  47.  
  48.   CODE
  49.   IF NOT MEU:sHelpID THEN MEU:sHelpID = eHelpID. ! Set default Help ID
  50.   IF MEU:bbShowStatus THEN OPEN(wStatus).        ! Open status line
  51.  
  52.   isSavCol = 0                                   ! Reset column
  53.   bbNewCol = 0                                   !
  54.   DO EditLoop                                    ! Edit the memo
  55.   IF MEU:bbShowStatus THEN CLOSE(wStatus).       ! Close status line
  56.  
  57.   SETCURSOR                                      ! Turn off cursor
  58.   RETURN                                         !
  59.  
  60. !──────────────────────────────────────────────────────────────────────────
  61. EditLoop     ROUTINE      ! Main edit loop
  62. !──────────────────────────────────────────────────────────────────────────
  63.   bbExit = 0                                     ! Clear exit flag
  64.   DO UpdatePos                                   ! Update position variables
  65.   DO StatusLine                                  ! Display status line
  66.   MEU:bbShowStatus = 1                           ! Set status line flag
  67.   LOOP UNTIL bbExit                              ! Loop
  68.     ME_CurPos()                                  !   Display cursor
  69.     ASK                                          !   Get keystroke
  70.     isKeystroke = KEYCODE()                      !   Get keystroke
  71.     DO SaveCol                                   !   Save current column
  72.     IF INRANGE(isKeystroke, 32, 254)             !   If printable char
  73.       DO InsChar                                 !     Insert into buffer
  74.     ELSE                                         !   Else
  75.       bbAlerted = IsAlerted(isKeystroke)         !     Save ALERTed status
  76.       DO CheckAlerts                             !     Check for ALERTed keys
  77.       IF NOT bbExit                              !     If exit flag not set
  78.         DO EditAction                            !       Perform edit action
  79.         IF NOT bbCommand THEN DO OtherKeys.      !       Handle any other keys
  80.     . .                                          !   Endif
  81.     DO UpdatePos                                 !   Update position variables
  82.     IF KEYBOARD() THEN CYCLE.                    !   Cycle if a key is pending
  83.     IF MED:bbBlockMark                           !   If marking a block
  84.       MED:isBlockEnd = MED:usPosition            !     Update block end
  85.       ME_SetPage()                               !     Invalidate page
  86.     .                                            !   Endif
  87.     ME_ShowPage()                                !   Display page
  88.     IF MEU:bbShowStatus THEN DO StatusLine.      !   Display status line
  89.     MEU:bbShowStatus = 1                         !   Set status flag
  90.   .                                              ! End loop
  91.  
  92. !──────────────────────────────────────────────────────────────────────────
  93. CheckAlerts  ROUTINE      ! Check for ALERTed key priority and mouse clicks
  94. !──────────────────────────────────────────────────────────────────────────
  95.   IF INRANGE(isKeystroke, MouseLeft, MouseLeft2) !If mouse click
  96.     bbExit = 1                                   !   Set exit flag
  97.   ELSIF MEU:bbAlrtBfrCmd AND bbAlerted           ! Elsif ALERTs have priority
  98.     bbExit = 1                                   !   Set exit flag
  99.   .                                              ! Endif
  100.  
  101. !──────────────────────────────────────────────────────────────────────────
  102. EditAction   ROUTINE      ! Perform an editing function
  103. !──────────────────────────────────────────────────────────────────────────
  104.   bbCommand = 1                                  ! Set command flag
  105.   CASE isKeystroke                               ! Process keystroke:
  106.  
  107.     OF F1Key; HELP(,MEU:sHelpID); HELP           !   Help key
  108.  
  109.     OF LeftKey;      DO MoveLeft                 !   Horizontal movement
  110.     OF RightKey;     DO MoveRight                !
  111.     OF HomeKey;      DO MoveBOL                  !
  112.     OF EndKey;       DO MoveEOL                  !
  113.     OF CtrlLeft;     DO MovePrevWord             !
  114.     OF CtrlRight;    DO MoveNextWord             !
  115.  
  116.     OF UpKey;        DO MoveUp                   !   Vertical movement
  117.     OF DownKey;      DO MoveDown                 !
  118.  
  119.     OF PgUpKey;      DO PageUp                   !   Page movement
  120.     OF PgDnKey;      DO PageDown                 !
  121.     OF CtrlPgUp;     DO FirstPage                !
  122.     OF CtrlPgDn;     DO LastPage                 !
  123.  
  124.     OF InsKey;       DO ToggleIns                !   Insertion
  125.     OF EnterKey;     DO InsHRt                   !
  126.  
  127.     OF CtrlO;        DO ToggleCodes              !   Text attributes
  128.  
  129.     OF DelKey;       DO DelChar                  !   Deletion
  130.     OF BSKey;        DO Backspace                !
  131.     OF CtrlHome;     DO DelLine                  !
  132.     OF CtrlEnd;      DO DelEOL                   !
  133.  
  134.     OF CtrlC;        DO CopyBlock                !   Copy block
  135.     OF CtrlM;        DO MoveBlock                !   Move block
  136.     OF CtrlD;        DO DelBlock                 !   Cut block to clipboard
  137.     OF CtrlP;        DO FileBlock                !   Save block to ASCII file
  138.     OF CtrlG;        ME_PasteFile()              !   Paste a file
  139.  
  140.   ELSE                                           ! Else
  141.     bbCommand = 0                                !   Clear command flag
  142.   .                                              ! Endif
  143.  
  144.  
  145. !──────────────────────────────────────────────────────────────────────────
  146. OtherKeys    ROUTINE      ! Handle other keys
  147. !──────────────────────────────────────────────────────────────────────────
  148.   IF bbAlerted                                   ! If key is ALERTed
  149.     bbExit = 1                                   !   Set flag
  150.   ELSE                                           ! Else
  151.     BEEP                                         !   Beep
  152.   .                                              ! End if
  153.  
  154. !──────────────────────────────────────────────────────────────────────────
  155. FileBlock     ROUTINE     ! Save text block to ASCII file
  156. !──────────────────────────────────────────────────────────────────────────
  157.   MES:ssStatus = CENTER(eFileMsg, 76)            ! Display source prompt
  158.   ME_MarkOn()                                    ! Turn on block marking
  159.   DO MoveMode                                    ! Enter restricted move mode
  160.   ME_MarkOff()                                   ! Exit marking mode
  161.   IF isKeystroke = EnterKey                      ! If Enter pressed
  162.     ME_Copy2File()                               !   Copy block to file
  163.   .                                              ! Endif
  164.   MED:bbBlockShow = 0                            ! Hide block
  165.   ME_SetPage()                                   ! Redisplay page
  166.   ME_ShowPage()                                  !
  167.  
  168. !──────────────────────────────────────────────────────────────────────────
  169. CopyBlock     ROUTINE     ! Copy text block
  170. !──────────────────────────────────────────────────────────────────────────
  171.   MES:ssStatus = CENTER(eCopy1Msg, 76)           ! Display source prompt
  172.   ME_MarkOn()                                    ! Turn on block marking
  173.   DO MoveMode                                    ! Enter restricted move mode
  174.   ME_MarkOff()                                   ! Exit marking mode
  175.   IF isKeystroke = EnterKey                      ! If Enter pressed
  176.     MES:ssStatus = CENTER(eCopy2Msg, 76)         !   Display dest. prompt
  177.     DO MoveMode                                  !   Enter restricted move mode
  178.     IF isKeystroke = EnterKey                    !   If Enter pressed
  179.       ME_Copy2Clip()                             !     Copy block to clipboard
  180.       ME_PasteClip()                             !     Paste block
  181.       bbNewCol = 1                               !
  182.   . .                                            ! Endif
  183.   MED:bbBlockShow = 0                            ! Hide block
  184.   ME_SetPage()                                   ! Redisplay page
  185.   ME_ShowPage()                                  !
  186.  
  187. !──────────────────────────────────────────────────────────────────────────
  188. MoveBlock     ROUTINE     ! Move text block
  189. !──────────────────────────────────────────────────────────────────────────
  190.   MES:ssStatus = CENTER(eMove1Msg, 76)           ! Display source prompt
  191.   ME_MarkOn()                                    ! Turn on block marking
  192.   DO MoveMode                                    ! Enter restricted move mode
  193.   ME_MarkOff()                                   ! Exit marking mode
  194.   IF isKeystroke = EnterKey                      ! If Enter pressed
  195.     MES:ssStatus = CENTER(eMove2Msg, 76)         !   Display dest. prompt
  196.     DO MoveMode                                  !   Enter restricted move mode
  197.     IF isKeystroke = EnterKey                    !   If Enter pressed
  198.       SavPos# = MED:usPosition                   !     Save current position
  199.       ME_Copy2Clip()                             !     Copy new block
  200.       ME_PasteClip()                             !     Paste new block
  201.       MED:bbBlockShow = 1                        !     Reshow block
  202.       ME_Cut2Clip()                              !     Cut old block
  203.       bbNewCol = 1                               !
  204.       MED:usPosition = SavPos#                   !     Restore position
  205.   . .                                            ! Endif
  206.   MED:bbBlockShow = 0                            ! Hide block
  207.   ME_SetPage()                                   ! Redisplay page
  208.   ME_ShowPage()                                  !
  209.  
  210. !──────────────────────────────────────────────────────────────────────────
  211. DelBlock     ROUTINE      ! Delete text block
  212. !──────────────────────────────────────────────────────────────────────────
  213.   MES:ssStatus = CENTER(eDeleteMsg, 76)          ! Display prompt
  214.   ME_MarkOn()                                    ! Turn on block marking
  215.   ME_SetPage()                                   ! Redisplay page
  216.   ME_ShowPage()                                  !
  217.   DO MoveMode                                    ! Enter restricted move mode
  218.   IF isKeystroke = EnterKey                      ! If Enter pressed
  219.     ME_Cut2Clip()                                !   Cut block to clipboard
  220.     bbNewCol = 1                                 !
  221.   .                                              ! Endif
  222.   ME_MarkOff()                                   ! Turn off block marking
  223.   MED:bbBlockShow = 0                            !
  224.   ME_SetPage()                                   !
  225.   ME_ShowPage()                                  !
  226.  
  227. !──────────────────────────────────────────────────────────────────────────
  228. MoveMode     ROUTINE      ! Enter restricted move mode
  229. !──────────────────────────────────────────────────────────────────────────
  230.   ME_SetPage()                                   ! Redisplay page
  231.   ME_ShowPage()                                  !
  232.   LOOP                                           ! Loop
  233.     ME_CurPos()                                  !   Display cursor
  234.     ASK                                          !   Get keystroke
  235.     isKeystroke = KEYCODE()                      !   Get keystroke
  236.     DO SaveCol                                   !   Save current column
  237.     CASE KEYCODE()                               !   Process keycode
  238.       OF LeftKey;    DO MoveLeft                 !   Horizontal movement
  239.       OF RightKey;   DO MoveRight                !
  240.       OF HomeKey;    DO MoveBOL                  !
  241.       OF EndKey;     DO MoveEOL                  !
  242.       OF CtrlLeft;   DO MovePrevWord             !
  243.       OF CtrlRight;  DO MoveNextWord             !
  244.       OF UpKey;      DO MoveUp                   !   Vertical movement
  245.       OF DownKey;    DO MoveDown                 !
  246.       OF PgUpKey;    DO PageUp                   !   Page movement
  247.       OF PgDnKey;    DO PageDown                 !
  248.       OF CtrlPgUp;   DO FirstPage                !
  249.       OF CtrlPgDn;   DO LastPage                 !
  250.       OF EnterKey;   BREAK                       !
  251.       OF EscKey;     BREAK                       !
  252.     .                                            !
  253.     DO UpdatePos                                 !   Update position variables
  254.     IF MED:bbBlockMark                           !   If marking a block
  255.       MED:isBlockEnd = MED:usPosition            !     Update block end
  256.       ME_SetPage()                               !     Invalidate page
  257.     .                                            !   Endif
  258.     ME_ShowPage()                                !   Refresh page
  259.   .                                              ! End loop
  260.  
  261. !──────────────────────────────────────────────────────────────────────────
  262. MoveLeft     ROUTINE      ! Move left one character
  263. !──────────────────────────────────────────────────────────────────────────
  264.   IF MED:usPosition > 0                          !
  265.     MED:usPosition -= 1                          !
  266.   .                                              !
  267.   bbNewCol = 1                                   !
  268.  
  269. !──────────────────────────────────────────────────────────────────────────
  270. MoveRight    ROUTINE      ! Move right one character
  271. !──────────────────────────────────────────────────────────────────────────
  272.   IF MED:usPosition < MED:usCharacters - 1       !
  273.     MED:usPosition += 1                          !
  274.   .                                              !
  275.   bbNewCol = 1                                   !
  276.  
  277. !──────────────────────────────────────────────────────────────────────────
  278. MoveBOL      ROUTINE      ! Move to beginning of line
  279. !──────────────────────────────────────────────────────────────────────────
  280.   MED:usPosition = MED:usLineStart               !
  281.   bbNewCol = 1                                   !
  282.  
  283. !──────────────────────────────────────────────────────────────────────────
  284. MoveEOL      ROUTINE      ! Move to end of line
  285. !──────────────────────────────────────────────────────────────────────────
  286.   MED:usPosition = MED:usLineEnd                 !
  287.   bbNewCol = 1                                   !
  288.  
  289. !──────────────────────────────────────────────────────────────────────────
  290. MovePrevWord ROUTINE      ! Move to previous word
  291. !──────────────────────────────────────────────────────────────────────────
  292.   Position# = ME_WordLeft(MED:usPosition)        ! Search for previous word
  293.   IF Position# >= 0                              ! If one was found
  294.     MED:usPosition = Position#                   !   Set to new position
  295.     bbNewCol = 1                                 !
  296.   .                                              ! Endif
  297.  
  298. !──────────────────────────────────────────────────────────────────────────
  299. MoveNextWord ROUTINE      ! Move to next word
  300. !──────────────────────────────────────────────────────────────────────────
  301.   Position# = ME_WordRight(MED:usPosition)       ! Search for next word
  302.   IF Position# >= 0                              ! If one was found
  303.     MED:usPosition = Position#                   !   Set to new position
  304.     bbNewCol = 1                                 !
  305.   .                                              ! Endif
  306.  
  307. !──────────────────────────────────────────────────────────────────────────
  308. MoveUp       ROUTINE      ! Move up one line
  309. !──────────────────────────────────────────────────────────────────────────
  310.   IF MED:usLineNdx > 1                           ! If not on first line
  311.     MED:usLineNdx -= 1                           !   Move up
  312.     MED:usPosition = ME_LineStart(MED:usLineNdx) !
  313.     DO RestoreCol                                !   Adjust column
  314.   .                                              ! Endif
  315.  
  316. !──────────────────────────────────────────────────────────────────────────
  317. MoveDown     ROUTINE      ! Move down one line
  318. !──────────────────────────────────────────────────────────────────────────
  319.   IF MED:usLineNdx < RECORDS(qLine)              ! If not on last line
  320.     MED:usLineNdx += 1                           !   Move down
  321.     MED:usPosition = ME_LineStart(MED:usLineNdx) !
  322.     DO RestoreCol                                !   Adjust column
  323.   .                                              ! Endif
  324.  
  325. !──────────────────────────────────────────────────────────────────────────
  326. PageUp       ROUTINE      ! Scroll one page up
  327. !──────────────────────────────────────────────────────────────────────────
  328.   IF MED:usLineNdx > MED:usPageTop + 1           !
  329.     MED:usLineNdx = MED:usPageTop + 1            !
  330.   ELSIF MED:usLineNdx > MED:ubWndRows            !
  331.     MED:usLineNdx -= MED:ubWndRows               !
  332.   ELSE                                           !
  333.     MED:usLineNdx = 1                            !
  334.   .                                              !
  335.   MED:usPosition = ME_LineStart(MED:usLineNdx)   !
  336.   DO RestoreCol                                  !
  337.  
  338. !──────────────────────────────────────────────────────────────────────────
  339. PageDown     ROUTINE      ! Scroll one page down
  340. !──────────────────────────────────────────────────────────────────────────
  341.   IF MED:usLineNdx < MED:usPageTop + MED:ubWndRows
  342.     MED:usLineNdx = MED:usPageTop + MED:ubWndRows!
  343.   ELSE                                           !
  344.     MED:usLineNdx += MED:ubWndRows               !
  345.   .                                              !
  346.   IF MED:usLineNdx > RECORDS(qLine) THEN MED:usLineNdx = RECORDS(qLine).
  347.   MED:usPosition = ME_LineStart(MED:usLineNdx)   !
  348.   DO RestoreCol                                  !
  349.  
  350. !──────────────────────────────────────────────────────────────────────────
  351. FirstPage    ROUTINE      ! Display first page
  352. !──────────────────────────────────────────────────────────────────────────
  353.   MED:usLineNdx  = 1                             ! Position to first page
  354.   MED:usPosition = ME_LineStart(MED:usLineNdx)   !
  355.   DO RestoreCol                                  ! Adjust column
  356.  
  357. !──────────────────────────────────────────────────────────────────────────
  358. LastPage     ROUTINE      ! Display last page
  359. !──────────────────────────────────────────────────────────────────────────
  360.   MED:usLineNdx  = RECORDS(qLine)                ! Position to last page
  361.   MED:usPosition = ME_LineStart(MED:usLineNdx)   !
  362.   DO RestoreCol                                  ! Adjust column
  363.  
  364. !──────────────────────────────────────────────────────────────────────────
  365. ToggleIns    ROUTINE      ! Toggle insert/overwrite mode
  366. !──────────────────────────────────────────────────────────────────────────
  367.   MED:bbInsertMode = BXOR(MED:bbInsertMode, 1)   ! Toggle insert flag
  368.  
  369. !──────────────────────────────────────────────────────────────────────────
  370. ToggleCodes  ROUTINE      ! Toggle display of formatting codes
  371. !──────────────────────────────────────────────────────────────────────────
  372.   MED:bbShowCodes = BXOR(MED:bbShowCodes, 1)     ! Toggle flag
  373.   ME_SetPage()                                   ! Set page redisplay
  374.  
  375. !──────────────────────────────────────────────────────────────────────────
  376. InsChar      ROUTINE      ! Insert an ordinary character
  377. !──────────────────────────────────────────────────────────────────────────
  378.   IF ME_BufrFull() THEN EXIT.                    ! Exit if buffer is full
  379.   MED:bbHasChanged = 1                           ! Set flag and insert char
  380.   IF MED:bbInsertMode                            ! Insert character
  381.     ME_InsTxt(MED:usPosition, 1, CHR(isKeystroke))
  382.   ELSE                                           !
  383.     ubChar = ME_GetChar(MED:usPosition)          !
  384.     IF ubChar = eHRt                             !
  385.       ME_InsTxt(MED:usPosition, 1, CHR(isKeystroke))
  386.     ELSE                                         !
  387.       ME_PutChar(MED:usPosition, isKeystroke)    !
  388.   . .                                            !
  389.   ME_ReformPar(MED:usPosition)                   ! Reformat paragraph
  390.   DO MoveRight                                   ! Move point position
  391.  
  392. !──────────────────────────────────────────────────────────────────────────
  393. InsHRt       ROUTINE      ! Insert a Hard Return code
  394. !──────────────────────────────────────────────────────────────────────────
  395.   IF ME_BufrFull() THEN EXIT.                    ! Exit if buffer is full
  396.   MED:bbHasChanged = 1                           ! Set flag and insert hard CR
  397.   ME_InsTxt(MED:usPosition, 1, CHR(eHRt))        !
  398.   ME_ReformDoc()                                 ! Reformat document
  399.   DO MoveRight                                   ! Move point position
  400.  
  401. !──────────────────────────────────────────────────────────────────────────
  402. Backspace    ROUTINE      ! Delete character before cursor
  403. !──────────────────────────────────────────────────────────────────────────
  404.   IF MED:usPosition                              ! If not at first character
  405.     MED:usPosition -= 1                          !   Move back one
  406.     DO DelChar                                   !   Delete character
  407.   .                                              ! Endif
  408.  
  409. !──────────────────────────────────────────────────────────────────────────
  410. DelChar      ROUTINE      ! Delete character under cursor
  411. !──────────────────────────────────────────────────────────────────────────
  412.   MED:bbHasChanged = 1                           ! Set modified flag
  413.   IF MED:bbBlockMark                             ! If block is marked
  414.     ME_Cut2Clip()                                !   Cut to clipboard
  415.     bbNewCol = 1                                 !
  416.   ELSE                                           ! Else
  417.     ME_DelChar()                                 !   Delete character
  418.   .                                              ! Endif
  419.  
  420. !──────────────────────────────────────────────────────────────────────────
  421. DelLine      ROUTINE      ! Delete current line
  422. !──────────────────────────────────────────────────────────────────────────
  423.   MED:bbHasChanged = 1                           ! Set modified flag
  424.   ME_DelLine()                                   ! Delete line
  425.   bbNewCol = 1                                   !
  426.  
  427. !──────────────────────────────────────────────────────────────────────────
  428. DelEOL       ROUTINE      ! Delete to end-of-line
  429. !──────────────────────────────────────────────────────────────────────────
  430.   MED:bbHasChanged = 1                           ! Set modified flag
  431.   ME_DelEOL()                                    ! Delete to EOL
  432.  
  433. !──────────────────────────────────────────────────────────────────────────
  434. UpdatePos    ROUTINE      ! Update position variables
  435. !──────────────────────────────────────────────────────────────────────────
  436.   MED:usLineNdx   = ME_LineIndex(MED:usPosition)
  437.   MED:usLineStart = ME_LineStart(MED:usLineNdx)
  438.   MED:usLineEnd   = ME_LineEnd(MED:usLineNdx)
  439.  
  440. !──────────────────────────────────────────────────────────────────────────
  441. SaveCol      ROUTINE      ! Save current column index
  442. !──────────────────────────────────────────────────────────────────────────
  443.   IF bbNewCol                                    ! If column change
  444.     isSavCol = MED:usPosition - MED:usLineStart  !   Save new column
  445.     bbNewCol = 0                                 !   Clear new column flag
  446.   .                                              ! Endif
  447.  
  448. !──────────────────────────────────────────────────────────────────────────
  449. RestoreCol   ROUTINE      ! Restore column after vertical motion
  450. !──────────────────────────────────────────────────────────────────────────
  451.   DO UpdatePos                                   !
  452.   MED:usPosition += isSavCol                     !
  453.   IF MED:usPosition >= MED:usLineEnd             !
  454.     MED:usPosition = MED:usLineEnd               !
  455.   .                                              !
  456.  
  457. !──────────────────────────────────────────────────────────────────────────
  458. StatusLine   ROUTINE      ! Display status line
  459. !──────────────────────────────────────────────────────────────────────────
  460.   IF NOT MEU:bbShowStatus THEN EXIT.
  461.   sStatus = 'F1 Help   Line: ' & MED:usLineNdx & '   Col: ' & |
  462.             1+ (MED:usPosition - MED:usLineStart)
  463.   MES:ssStatus = sStatus
  464.  
  465.  
  466. !═════════════════════════════════════════════════════════════════════════
  467. !                   Check for edit buffer overflow
  468. !═════════════════════════════════════════════════════════════════════════
  469. ME_BufrFull  FUNCTION
  470.  
  471.              ! Return:
  472. bbRetVal     BYTE                                ! Return flag
  473.  
  474.              ! Screen:
  475. wBufferFull  SCREEN(6,38),COLOR(244)
  476.                ROW(1,37)  PAINT(1,2),TRN
  477.                ROW(2,37)  PAINT(4,2),COLOR(128),TRN
  478.                ROW(6,3)   PAINT(1,36),COLOR(128),TRN
  479.                ROW(6,1)   PAINT(1,2),TRN
  480.                ROW(1,1)   STRING('╔═{34}╗')
  481.                ROW(2,1)   REPEAT(3);STRING('║<0{34}>║') .
  482.                ROW(5,1)   STRING('╚═{34}╝')
  483.                ROW(3,4)   STRING('There is no more room for text')
  484.              .
  485.  
  486.   CODE
  487.   bbRetVal = 0                                   ! Assume enough room
  488.   IF MED:usCharacters >= MED:usMaxChars          ! If max lines exceeded
  489.     OPEN(wBufferFull)                            !   Notify user
  490.     SETCURSOR                                    !
  491.     BEEP; ASK                                    !
  492.     CLOSE(wBufferFull)                           !
  493.     bbRetVal = 1                                 !   Set return flag
  494.   .                                              ! Endif
  495.   RETURN( bbRetVal )                             !
  496.  
  497.